/*
 * xBase.cpp
 *
 *  Created on: 2010/02/11
 *      Author: peter.song
 */

#include "CommonDefines.h"
#include "Thread.h"
#include "xBase.h"

void* CXBase::operator new(std::size_t size){
	if(size <= BIN_SIZE[EN_BIN256]){
		// Get thread local storage for thread local pool address.
		if(TH_LOCAL_MEMPOOL_PTR){
			return TH_LOCAL_MEMPOOL_PTR->New(size);
		}
	}
	else{
		return ::operator new(size);
	}
}

void CXBase::operator delete(void* ptrObject, std::size_t size){
	if(size <= BIN_SIZE[EN_BIN256]){
		// Get thread local storage for thread local pool address.
		if(TH_LOCAL_MEMPOOL_PTR){
			TH_LOCAL_MEMPOOL_PTR->Delete(ptrObject, size);
		}
	}
	else{
		::operator delete(ptrObject);
	}
}
